package main

import (
	"fmt"
	"time"
)


func worker(i int, c chan int)  {
	for  {
		fmt.Printf("worker %d received %c \n", i, <-c)
		time.Sleep(time.Second * 1)
	}
}

func chanDemo()  {
	var channels [10]chan int

	for i := 0; i < 10; i++ {
		channels[i] = make(chan int)
		go worker(i, channels[i])
	}

	for i := 0; i < 10; i++ {
		channels[i] <- 'A' + i
	}
	for i := 0; i < 10; i++ {
		channels[i] <- 'a' + i
	}


}

func main() {
	chanDemo()

}
